package com.pig.util;



import java.io.Serializable;

//借助此对象封装控制层响应到客户端的数据

public class JsonResult implements Serializable {
    private static final long serialVersionUID = 951620565065577038L;
    /**状态:1 ok,0 error*/
    private Integer state=1;
    /**状态信息*/
    private String message="ok";
    /**业务层返回的正确响应数据*/
    private Object data;

    public JsonResult(String message){ //new JsonResult("update ok");
        this.message=message;
    }
    public JsonResult(Object data){
        this.data=data;
    }
    public JsonResult(Throwable e){
        this.state=0;
        this.message=e.getMessage();
    }
}
